<%@ page language="java" import="java.util.*" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/context/mytags.jsp" %>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<t:formvalid formid="formobj" dialog="false" usePlugin="password" layout="table"
             action="processInstanceController.do?reassign" tiptype="3">
    <table>
        <tr>
            <td>转派人：</td>
            <td>
                <select name="userName" id="userName">
                    <option value="">--请选择--</option>
                    <c:forEach items="${roleUser }" var="roleUser">
                        <c:if test="${currentUser ne roleUser.TSUser.userName}">
                            <option value="${roleUser.TSUser.userName }">${roleUser.TSUser.realName }</option>
                        </c:if>
                    </c:forEach>
                </select>
                <span class="Validform_checktip Validform_wrong" id="vMsg" style="display: none;">请选择转派人！</span>
            </td>
        </tr>
        <c:if test="${type eq 'hd' || type eq 'appoint'}">
            <tr>
                <td>转派理由：</td>
                <td>
                    <textarea rows="6" datatype="*0-150" cols="60" id="content"></textarea>
                </td>
            </tr>
        </c:if>
    </table>
    <div style="text-align: center;margin: 10px;">
        <a class="easyui-linkbutton" onclick="transferredSub()">提交</a>
    </div>
</t:formvalid>
<script type="text/javascript">


    function transferredSub() {
        var type = '${type}';
        var userName = $('#userName').val();
        if (userName == '') {
            $('#vMsg').show();
            return;
        }
        var content = $('#content').val();
        if(content != undefined && content.length > 150){
            $.Showmsg("转派理由过长，不能超过150个字符");
            return;
        }
        $.post('cbsProcurementNoteController.do?reassign', {
            taskId: '${taskId}',
            userName: userName,
            busId: '${busId}',
            instId: '${instId}',
            content: content,
            type:type
        }, function (data) {
            data = $.parseJSON(data);
            top.tip(data.msg);
            var win = frameElement.api.opener;
            win.reloadTable();
            top.myWindow.close();
            frameElement.api.close();

        });
    }
</script>